Skip to content

Improvement #8895 : 'invalid request BLR' puts actual error (and procedure where it happened) at the end where it is truncated by ISC API#8900

Merged
hvlad merged 1 commit intov5.0-releasefrom
work/gh-8895
Feb 12, 2026
Merged

Improvement #8895 : 'invalid request BLR' puts actual error (and procedure where it happened) at the end where it is truncated by ISC API#8900
hvlad merged 1 commit intov5.0-releasefrom
work/gh-8895

Conversation

@hvlad
Copy link
Member

@hvlad hvlad commented Feb 11, 2026

Revert order of entires in status-vector so that original error is put on the top, not at the bottom

…edure where it happened) at the end where it is truncated by ISC API
@dyemanov
Copy link
Member

Could you please show the error stack before and after the fix? I'm afraid this gonna break all programmer checks like status[1] == isc_bad_proc_BLR to check whether BLR is known to be invalid.

@hvlad
Copy link
Member Author

hvlad commented Feb 11, 2026

Could you please show the error stack before and after the fix?

Before:

SQL> select fn_test3() from rdb$database;
Statement failed, SQLSTATE = 2F000
Error while parsing function FN_TEST3's BLR
-Error while parsing function FN_TEST2's BLR
-Error while parsing function FN_TEST1's BLR
-invalid request BLR at offset 32
-function UDF_SRAND is not defined
-module name or entrypoint could not be found

After:

SQL> select fn_test3() from rdb$database;
Statement failed, SQLSTATE = 39000
invalid request BLR at offset 32
-function UDF_SRAND is not defined
-module name or entrypoint could not be found
-Error while parsing function FN_TEST1's BLR
-Error while parsing function FN_TEST2's BLR
-Error while parsing function FN_TEST3's BLR

Also, note, now this order is the same as in execution error:

SQL> select fn_test3() from rdb$database;

    FN_TEST3
============
Statement failed, SQLSTATE = 39000
function UDF_SRAND is not defined
-module name or entrypoint could not be found
-At function 'FN_TEST1' line: 5, col: 3
At function 'FN_TEST2' line: 5, col: 3
At function 'FN_TEST3' line: 5, col: 3

I'm afraid this gonna break all programmer checks like status[1] == isc_bad_proc_BLR to check whether BLR is known to be invalid.

I would be very surprized if someone look for error code in status[1] only.

@dyemanov
Copy link
Member

I would be very surprized if someone look for error code in status[1] only.

It's a common practice in the Firebird codebase :) In RDB, we check for isc_bad_proc_BLR and its friends in gbak in order to restore databases with invalid BLR. Of course, this check can be improved to search through the whole status vector, but it would look inconsistent with another error handlers across the codebase. With the new code, perhaps we could rely on isc_invalid_blr instead, but old checks are still needed for backward compatibility. Sigh.

@hvlad
Copy link
Member Author

hvlad commented Feb 12, 2026

I would be very surprized if someone look for error code in status[1] only.

It's a common practice in the Firebird codebase :)

Not always. Usually it depends on exact knowledge of what error code is primary.

In RDB, we check for isc_bad_proc_BLR and its friends in gbak in order to restore databases with invalid BLR.

isc_bad_proc_BLR is not primary error. It means that something wrong happens when BLR was parsed and specify unlucky routine name. But this is not necessary "bad BLR" as in the case above.

Of course, this check can be improved to search through the whole status vector, but it would look inconsistent with another error handlers across the codebase. With the new code, perhaps we could rely on isc_invalid_blr instead, but old checks are still needed for backward compatibility. Sigh.

BTW, this PR restored how error looks like before v3.
So, do you object to this PR or have I convinced you ?

@dyemanov
Copy link
Member

I have no objections, just some headache to figure out the best way to fix things back ;)

@hvlad hvlad merged commit db4142c into v5.0-release Feb 12, 2026
44 of 64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'invalid request BLR' puts actual error (and procedure where it happened) at the end where it is truncated by ISC API

2 participants